package com.nas.app;

public class Message implements Comparable {    
   private Type type;
   private String message;
   private Long threadId;
   private Long fromThreadId;
   private Long toThreadId;
   

public String getMessage() {
    return message;
}

public void setMessage(String message) {
    this.message = message;
}


public Type getType() {
    return type;
}

public void setType(Type type) {
    this.type = type;
}

public Long getThreadId() {
    return threadId;
}

public void setThreadId(Long threadId) {
    this.threadId = threadId;
}




public Long getFromThreadId() {
    return fromThreadId;
}

public void setFromThreadId(Long fromThreadId) {
    this.fromThreadId = fromThreadId;
}

public Long getToThreadId() {
    return toThreadId;
}

public void setToThreadId(Long toThreadId) {
    this.toThreadId = toThreadId;
}




public enum Type {RAW, TASK}


@Override
public int compareTo(Object arg0) {
    
    if (arg0 == null) return 1;
    String message = ((Message)arg0).getMessage();
    if ((message == null) && (this.message == null)) return 0;
    if ((message != null ) && (this.message == null)) return -1;
    if ((message == null ) && (this.message != null)) return 1;
    return this.message.compareTo(message);
}
   
}
